package main

import (
	"fmt"
)


func test()  {

	//使用defer+recover来捕获和处理异常
	defer func() {
		err := recover()  //recover()内置函数
		if err != nil {
			fmt.Println("err = ",err)
		}
	}()
	n1 := 10
	n2 := 0
	fmt.Println( n1/n2 )
}

func main()  {
	test()
	fmt.Println("main..")
}


